import request from '@/utils/request'

export function add(data) {
  return request({
    url: 'api/repay',
    method: 'post',
    data
  })
}

export function del(ids) {
  return request({
    url: 'api/repay/',
    method: 'delete',
    data: ids
  })
}

export function edit(data) {
  return request({
    url: 'api/repay',
    method: 'put',
    data
  })
}

export function getCalculateEqualPrincipalAndInterest(loanAmount, annualInterestRate, loanTermMonths) {
  return request({
    url: 'api/repay/equalPrincipalAndInterest?loanAmount=' + loanAmount + '&annualInterestRate=' + annualInterestRate + '&loanTermMonths=' + loanTermMonths,
    method: 'get'

  })
}

export function getEqualPrincipal(loanAmount, annualInterestRate, loanTermMonths) {
  return request({
    url: 'api/repay/equalPrincipal?loanAmount=' + loanAmount + '&annualInterestRate=' + annualInterestRate + '&loanTermMonths=' + loanTermMonths,
    method: 'get'

  })
}
export default { add, edit, del, getCalculateEqualPrincipalAndInterest, getEqualPrincipal }
